﻿using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using PHMEE.DTOS.StatusMonitor;
using PHMEE.IServices.StatusMonitor;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp;
using Volo.Abp.DependencyInjection;

namespace PHMEE.Controllers.StatusMonitor
{
    /// <summary>
    /// Echart谱图分析🚢🌞🌛✨
    /// </summary>
    [Route("api/spectralanalysis")]
    public class SpectralAnalysisController : PHMEEController
    {
        private readonly ISpectralAnalysisAppService spectralAnalysisAppService;

        public SpectralAnalysisController(ISpectralAnalysisAppService spectralAnalysisAppService)
        {
            this.spectralAnalysisAppService = spectralAnalysisAppService;
        }

        #region 时域

        /// <summary>
        /// 时域-加速度
        /// </summary>
        /// <param name="VesselId"></param>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpGet]
        [Route("GetChartTimeAcceleration")]
        public async Task<PhMEEChartModel> GetChartTimeAcceleration(Guid VesselId, ChartInput input)
        {
            return await spectralAnalysisAppService.GetChartTimeAcceleration(VesselId, input);
        }


        /// <summary>
        /// 时域-速度
        /// </summary>
        /// <param name="VesselId"></param>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpGet]
        [Route("GetChartTimeSpeed")]
        public async Task<PhMEEChartModel> GetChartTimeSpeed(Guid VesselId, ChartInput input)
        {
            return await spectralAnalysisAppService.GetChartTimeSpeed(VesselId, input);
        }


        /// <summary>
        /// 时域-包络
        /// </summary>
        /// <param name="VesselId"></param>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpGet]
        [Route("GetChartTimeEnvelope")]
        public async Task<PhMEEChartModel> GetChartTimeEnvelope(Guid VesselId, ChartInput input)
        {
            return await spectralAnalysisAppService.GetChartTimeEnvelope(VesselId, input);
        }

        #endregion


        #region 频域

        /// <summary>
        /// 频域-加速度
        /// </summary>
        /// <param name="VesselId"></param>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpGet]
        [Route("GetChartFrequencyAcceleration")]
        public async Task<PhMEEChartModel<float, float>> GetChartFrequencyAcceleration(Guid VesselId, ChartInput input)
        {
            return await spectralAnalysisAppService.GetChartFrequencyAcceleration(VesselId, input);
        }


        /// <summary>
        /// 频域-速度
        /// </summary>
        /// <param name="VesselId"></param>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpGet]
        [Route("GetChartFrequencySpeed")]
        public async Task<PhMEEChartModel<float, float>> GetChartFrequencySpeed(Guid VesselId, ChartInput input)
        {
            return await spectralAnalysisAppService.GetChartFrequencySpeed(VesselId, input);
        }

        #endregion


        #region 包络

        /// <summary>
        /// 包络-加速度
        /// </summary>
        /// <param name="VesselId"></param>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpGet]
        [Route("GetChartEnvelopeAccleration")]
        public async Task<PhMEEChartModel<float, float>> GetChartEnvelopeAccleration(Guid VesselId, ChartInput input)
        {
            return await spectralAnalysisAppService.GetChartEnvelopeAccleration(VesselId, input);
        }

        #endregion


        #region 倒谱

        /// <summary>
        /// 倒谱-加速度
        /// </summary>
        /// <param name="VesselId"></param>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpGet]
        [Route("GetChartCepstrumAcceleration")]
        public async Task<PhMEEChartModel<float, float>> GetChartCepstrumAcceleration(Guid VesselId, ChartInput input)
        {
            return await spectralAnalysisAppService.GetChartCepstrumAcceleration(VesselId, input);
        }

        #endregion


        #region 趋势

        /// <summary>
        /// 趋势-加速度-有效值
        /// </summary>
        /// <param name="VesselId"></param>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpGet]
        [Route("GetChartTrendAccelerationValid")]
        public async Task<PhMEEChartModel<string, object>> GetChartTrendAccelerationValid(Guid VesselId, ChartInputTrend input)
        {
            return await spectralAnalysisAppService.GetChartTrendAccelerationValid(VesselId, input);
        }


        /// <summary>
        /// 趋势-加速度-平均峰值
        /// </summary>
        /// <param name="VesselId"></param>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpGet]
        [Route("GetChartTrendAccelerationAverage")]
        public async Task<PhMEEChartModel<string, object>> GetChartTrendAccelerationAverage(Guid VesselId, ChartInputTrend input)
        {
            return await spectralAnalysisAppService.GetChartTrendAccelerationAverage(VesselId, input);
        }


        /// <summary>
        /// 趋势-速度-有效值
        /// </summary>
        /// <param name="VesselId"></param>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpGet]
        [Route("GetChartTrendSpeedValid")]
        public async Task<PhMEEChartModel<string, object>> GetChartTrendSpeedValid(Guid VesselId, ChartInputTrend input)
        {
            return await spectralAnalysisAppService.GetChartTrendSpeedValid(VesselId, input);
        }


        /// <summary>
        /// 趋势-包络-平均峰值
        /// </summary>
        /// <param name="VesselId"></param>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpGet]
        [Route("GetChartTrendEnvelopeAverage")]
        public async Task<PhMEEChartModel<string, object>> GetChartTrendEnvelopeAverage(Guid VesselId, ChartInputTrend input)
        {
            return await spectralAnalysisAppService.GetChartTrendEnvelopeAverage(VesselId, input);
        }

        #endregion


        #region TdEngine数据


        /// <summary>
        /// 时域-加速度-最新一条数据
        /// </summary>
        /// <param name="VesselId"></param>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpGet]
        [Route("GetChartTimeTdEngineSourceValueNewest")]
        public async Task<PhMEEChartModel> GetChartTimeTdEngineSourceValueNewest(Guid VesselId, ChartInputNewest input)
        {
            return await spectralAnalysisAppService.GetChartTimeTdEngineSourceValueNewest(VesselId, input);
        }


        /// <summary>
        /// 特征值
        /// </summary>
        /// <param name="VesselId"></param>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpGet]
        [Route("GetTdEngineFeatureValue")]
        public async Task<List<WaveDataFeature>> GetTdEngineFeatureValue(Guid VesselId, ChartInputTrend input)
        {
            return await spectralAnalysisAppService.GetTdEngineFeatureValue(VesselId, input);
        }

        #endregion

    }
}
